﻿NExt.resolvee = function (config) {
    if (typeof config == "undefined")
        return;

    var resolvedConfig = {};
    Ext.apply(resolvedConfig, config);

    for (var field in resolvedConfig) {
        var fieldValue = resolvedConfig[field];

        var isDate = Ext.isDate(fieldValue);
        var isFunction = Ext.isFunction(fieldValue);
        var isPrimtive = Ext.isPrimitive(fieldValue);

        if (isDate || isFunction || isPrimtive)
            continue;

        //var isArray = Ext.isArray(fieldValue);
        resolvedConfig[field] = NExt.create(fieldValue);
    }

    return resolvedConfig;
}

NExt.create = function (config) {
    if (!(config instanceof Array)) {
        if (!config.xtype)
            return config;
        return Ext.ComponentMgr.create(config);
    }

    var objects = [];
    for (var i = 0; i < config.length; i++) {
        var object = NExt.create(config[i]);
        //objects.addRange([object]);
        objects.push(object);
    }
    return objects;
}
